#!/bin/bash
wget https://cmake.org/files/v3.15/cmake-3.15.4-Linux-x86_64.sh -q && mkdir /tmp/cmake &&  printf "y\nn\n" | sh cmake-3.15.4-Linux-x86_64.sh --prefix=/tmp/cmake > /dev/null && rm -rf cmake-3.15.4-Linux-x86_64.sh
export PATH=/tmp/cmake/bin:$PATH

python3 -m pip install -U perspective-python

export NODE_OPTIONS=--max-old-space-size=32768

EXTENSIONS="
@jupyter-widgets/jupyterlab-manager@2.0.0
@finos/perspective-jupyterlab
@jupyter-voila/jupyterlab-preview@1.1.0
"


until jupyter labextension install $EXTENSIONS --no-build
do
    echo "Extension failed to install"
done

until jupyter lab build --dev-build=False --minimize=False
do
    echo "Extension failed to install"
done

jupyter serverextension enable --py jupyterlab
